#include <cstdio>
#define F(i, a, b) for (int i=a; i<=b; i++)
#define FG(i, o, f) for (int i=ind[o]; i; i=link[i]) if (to[i]!=fa)

using namespace std;

typedef long long ll;
const int maxn=5000;
int n, m, ind[maxn+1], link[2*maxn+1], to[2*maxn+1], dis[maxn+1][maxn+1];

void addEdge(int u, int v) {
    m++;
    to[m] = v;
    link[m] = ind[u];
    ind[u] = m;
}

void run(int o, int fa, int ro) {
    dis[ro][o] = ro==o ? 0 : dis[ro][fa]+1;
    FG(i, o, fa) {
        run(to[i], o, ro);
    }
}

int main() {
    freopen("zh.in", "r", stdin);
    freopen("checker.out", "w", stdout);

    scanf("%d", &n);
    F(i, 1, n-1) {
        int u, v;
        scanf("%d %d", &u, &v);
        addEdge(u, v), addEdge(v, u);
    }
    F(i, 1, n) run(i, 0, i);

    ll cnt=0;
    F(i, 1, n) {
        F(j, i+1, n) {
            F(k, j+1, n) {
                cnt += dis[i][j]==dis[j][k] && dis[j][k]==dis[k][i];
            }
        }
    }
    printf("%lld\n", cnt);

    fclose(stdin);
    fclose(stdout);
    return 0;
}
